import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEFSearchMode } from './ipsdefsearch-mode';
import { IPSDEField } from './ipsdefield';
import { IPSDERBase } from '../der/ipsderbase';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEFSearchModeImpl extends PSModelObjectImpl implements IPSDEFSearchMode {
  get codeName(): string {
    return this.M.codeName;
  }

  protected dstpsdefsearchmode: IPSDEFSearchMode | null = null;

  getDstPSDEFSearchMode(): IPSDEFSearchMode | null {
    if (this.dstpsdefsearchmode != null) return this.dstpsdefsearchmode;
    const value = this.M.getDstPSDEFSearchMode;
    if (value == null) {
      return null;
    }
    this.dstpsdefsearchmode = this.getDstPSDEFieldMust().findPSDEFSearchMode(value);
    return this.dstpsdefsearchmode;
  }

  get dstPSDEFSearchMode(): IPSDEFSearchMode | null {
    return this.getDstPSDEFSearchMode();
  }

  getDstPSDEFSearchModeMust(): IPSDEFSearchMode {
    const value = this.getDstPSDEFSearchMode();
    if (value == null) {
      throw new Error('未指定目标实体属性搜索模式');
    }
    return value;
  }

  protected dstpsdefield: IPSDEField | null = null;

  getDstPSDEField(): IPSDEField | null {
    if (this.dstpsdefield != null) return this.dstpsdefield;
    const value = this.M.getDstPSDEField;
    if (value == null) {
      return null;
    }
    this.dstpsdefield = this.getDstPSDataEntityMust().findPSDEField(value);
    return this.dstpsdefield;
  }

  get dstPSDEField(): IPSDEField | null {
    return this.getDstPSDEField();
  }

  getDstPSDEFieldMust(): IPSDEField {
    const value = this.getDstPSDEField();
    if (value == null) {
      throw new Error('未指定目标实体属性对象');
    }
    return value;
  }

  protected dstpsdataentity: IPSDataEntity | null = null;

  getDstPSDataEntity(): IPSDataEntity | null {
    if (this.dstpsdataentity != null) return this.dstpsdataentity;
    const value = this.M.getDstPSDataEntity;
    if (value == null) {
      return null;
    }
    this.dstpsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getDstPSDataEntity') as IPSDataEntity;
    return this.dstpsdataentity;
  }

  get dstPSDataEntity(): IPSDataEntity | null {
    return this.getDstPSDataEntity();
  }

  getDstPSDataEntityMust(): IPSDataEntity {
    const value = this.getDstPSDataEntity();
    if (value == null) {
      throw new Error('未指定目标实体对象');
    }
    return value;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get itemTag(): string {
    return this.M.itemTag;
  }

  get itemTag2(): string {
    return this.M.itemTag2;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psder: IPSDERBase | null = null;

  getPSDER(): IPSDERBase | null {
    if (this.psder != null) return this.psder;
    const value = this.M.getPSDER;
    if (value == null) {
      return null;
    }
    this.psder = this.getPSModel4('dataentity.der.IPSDERBase', value, 'getPSDER') as IPSDERBase;
    return this.psder;
  }

  get psDER(): IPSDERBase | null {
    return this.getPSDER();
  }

  getPSDERMust(): IPSDERBase {
    const value = this.getPSDER();
    if (value == null) {
      throw new Error('未指定相关实体关系对象');
    }
    return value;
  }

  get stdDataType(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 {
    return this.M.stdDataType;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get valueFormat(): string {
    return this.M.valueFormat;
  }

  get valueFunc(): string {
    return this.M.valueFunc;
  }

  get valueOP(): string {
    return this.M.valueOP;
  }

  get valueSeparator(): string {
    return this.M.valueSeparator;
  }

  get array(): boolean {
    return this.M.array != null ? this.M.array : false;
  }

  get default(): boolean {
    return this.M.default != null ? this.M.default : false;
  }

  get cls(): string {
    return 'PSDEFSearchModeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.defield.IPSDEFSearchMode') return true;
    return super.instanceof(cls);
  }
}
